package leetcode.code0590;

import java.util.ArrayList;
import java.util.List;

import leetcode.helper.tree.Node;

public class Solution2 {

	List<Integer> ans;

	public List<Integer> postorder(Node root) {
		ans = new ArrayList<>();
		this.find(root);
		return ans;
	}

	private void find(Node root) {
		if (root == null) {
			return;
		}
		for (Node node : root.children) {
			this.find(node);
		}
		ans.add(root.val);
	}
}
